/**
 * Created by yelan on 2018/8/19.
 */
import React, {Component} from 'react';
import PropTypes from 'prop-types';

class SearchBar extends Component {
    handleChange(event){
        this.props.onUserInput(event.target.value);
    }

    render(){
        return (
            <input type="text" placeholder="search"
            value={this.props.filterText}
            onChange={this.handleChange.bind(this)}/>
        )
    }
}

SearchBar.propTypes = {
    filterText: PropTypes.string.isRequired,
    onUserInput: PropTypes.func.isRequired
};

export default SearchBar;